package com.chif.mapreduce.ETLphone;

import com.chif.mapreduce.ETL.WebLogMapper;
import com.chif.mapreduce.LogOutputFormat.LogDriver;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;


public class ETLDriverPhone {

    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {

        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);

        job.setJarByClass(LogDriver.class);
        job.setMapperClass(WebLogMapper.class);

        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(NullWritable.class);
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(NullWritable.class);

        job.setNumReduceTasks(0);

        FileInputFormat.setInputPaths(job,new Path("C:\\Users\\Chef Liu\\Desktop\\Big\\input4"));
        FileOutputFormat.setOutputPath(job,new Path("C:\\Users\\Chef Liu\\Desktop\\Big\\output"));

        boolean b = job.waitForCompletion(true);
        System.exit(b?0:1);
    }
}
